<?php

/**
 * Photo form base class.
 *
 * @method Photo getObject() Returns the current form's model object
 *
 * @package    iEasy
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePhotoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'photo_id'       => new sfWidgetFormInputHidden(),
      'link'           => new sfWidgetFormTextarea(),
      'brief'          => new sfWidgetFormTextarea(),
      'photo_group_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Photogroup'), 'add_empty' => true)),
      'order_i'        => new sfWidgetFormInputText(),
      'daily_hit'      => new sfWidgetFormInputText(),
      'weekly_hit'     => new sfWidgetFormInputText(),
      'monthly_hit'    => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'photo_id'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('photo_id')), 'empty_value' => $this->getObject()->get('photo_id'), 'required' => false)),
      'link'           => new sfValidatorString(array('required' => false)),
      'brief'          => new sfValidatorString(array('required' => false)),
      'photo_group_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Photogroup'), 'required' => false)),
      'order_i'        => new sfValidatorInteger(array('required' => false)),
      'daily_hit'      => new sfValidatorInteger(array('required' => false)),
      'weekly_hit'     => new sfValidatorInteger(array('required' => false)),
      'monthly_hit'    => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('photo[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Photo';
  }

}
